<template>
  <div class="content">
    <el-form>
      <el-form-item>
        <el-checkbox-group v-model="checkList">
          {{typeSelectArr}}
          <el-checkbox v-for="item in typeSelectArr" :key="item.id" :label="item.name" :value='item.id'></el-checkbox>
        </el-checkbox-group>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'content',
  props: ['typeSelectArr', 'idSelectArr', 'contentClickOrNo'],
  // props:{
  //     typeSelectArr:{
  //         type: Array,
  //         require: true
  //     },
  //     idSelectArr:{
  //         type: Array,
  //         require: true
  //     }
  // },
  data() {
    return {
      checkList: [],
      childrenUpdata: 0,
    }
  },
  created() {
    this.idSelectArrChange()
  },
  methods: {
    idSelectArrChange() {
      let idSelectArr = this.idSelectArr
      this.$nextTick(function () {
        idSelectArr = this.idSelectArr
      })

      console.log(idSelectArr, 'moren')

      var arr = []
      for (let i = 0; i < idSelectArr.length; i++) {
        const name = idSelectArr[i].childrenName
        arr.push(name)
      }
      console.log('什么东西--', arr)
      this.checkList = arr
    },
  },
  watch: {
    checkList(newvalue) {
      console.log(newvalue)
      this.$emit('closedData', newvalue)
    },
    idSelectArr() {
      this.idSelectArrChange()
    },
  },
}
</script>

<style scoped lang='scss'>
.content {
  .el-checkbox-group {
    display: block;
    .el-checkbox {
      display: block;
    }
  }
}
</style>
